# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer:
pkgname=ocaml-cmdliner
_pkgname=cmdliner
pkgver=1.0.4
pkgrel=1
pkgdesc="Declarative definition of command line interfaces for OCaml"
url="http://erratique.ch/software/cmdliner"
arch="all !x86 !armhf !armv7 !s390x !mips !mips64"  # limited by ocaml aport
license="ISC"
depends="ocaml-result ocaml-runtime"
depends_dev="$pkgname=$pkgver-r$pkgrel"
makedepends="ocaml ocaml-findlib ocaml-result-dev ocamlbuild"
options="!check"  # no tests provided
subpackages="$pkgname-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/dbuenzli/$_pkgname/archive/v$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"

build() {
	make -j1
}

package() {
	make install DESTDIR="$pkgdir" PREFIX=/usr

	# Remove annotation files.
	rm -Rf "$pkgdir"/usr/lib/ocaml/$_pkgname/*.cmt*
}

dev() {
	local sitelib="usr/lib/ocaml/$_pkgname"
	default_dev

	cd "$pkgdir"/$sitelib

	mkdir -p "$subpkgdir"/$sitelib
	mv *.cmx *.cmxa *.mli "$subpkgdir"/$sitelib/
}

sha512sums="d8d2408fa2606295ec4cc1662f38a9ad675e009f948cac8e87354abf160b37e316969a24e3caf81b5a296eebbdc178f8a1655afcaf3840be71462b58337c359f  ocaml-cmdliner-1.0.4.tar.gz"
